Skip to content

fix(redis): reject subscription close signals when receiving - #42799

Merged
Stream29 merged 1 commit into
mainfrom
laipz8200/fix-redis-subscription-close
Oct 2, 2026
Merged

Stream29 merged 1 commit into
mainfrom
laipz8200/fix-redis-subscription-close

Conversation

@laipz8200

Copy link
Copy Markdown
Member

Summary

A receiver waiting on a Redis subscription can return its internal close signal as application data. Raise the existing subscription-closed exception instead and let workflow event buffering finish quietly on normal shutdown. Ensure concurrent producers start only after the sharded subscription is ready, and close the subscription when its consumer exits.

Extracted from #40277 so this fix can land independently of the Graphon upgrade.

Raise SubscriptionClosedError when a waiting receiver wakes on the internal close signal. Wait for the sharded subscription to become active before starting producers and close it when the concurrent consumer exits.
@github-actions github-actions Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 66.06% 66.06% -0.00%
Strict coverage 65.68% 65.67% -0.00%
Typed symbols 49,174 49,175 +1
Untyped symbols 25,408 25,412 +4
Modules 3509 3509 0

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-09-23 06:47:13.922651700 +0000
+++ /tmp/pyrefly_pr.txt	2026-09-23 06:47:05.922539481 +0000
@@ -759,7 +759,7 @@
 ERROR Argument `Literal['owner']` is not assignable to parameter `role` with type `SQLCoreOperations[TenantAccountRole] | TenantAccountRole` in function `models.account.TenantAccountJoin.__init__` [bad-argument-type]
   --> tests/test_containers_integration_tests/helpers/execution_extra_content.py:48:14
 ERROR Returned type `int | str` is not assignable to declared return type `str` [bad-return]
-   --> tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_sharded_channel.py:363:16
+   --> tests/test_containers_integration_tests/libs/broadcast_channel/redis/test_sharded_channel.py:367:16
 ERROR Object of class `TypeEngine` has no attribute `length` [missing-attribute]
    --> tests/test_containers_integration_tests/models/test_types_enum_text.py:104:16
 ERROR Object of class `NoneType` has no attribute `user_type` [missing-attribute]
@@ -6931,7 +6931,7 @@
 ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[bool] | bool` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
    --> tests/unit_tests/services/workflow/test_workflow_draft_variable_service.py:705:37
 ERROR Argument `None` is not assignable to parameter `value` with type `SQLCoreOperations[datetime] | datetime` in function `sqlalchemy.orm.base.Mapped.__set__` [bad-argument-type]
-   --> tests/unit_tests/services/workflow/test_workflow_event_snapshot_service.py:506:30
+   --> tests/unit_tests/services/workflow/test_workflow_event_snapshot_service.py:507:30
 ERROR Argument `dict[str, list[Unknown] | str | dict[str, bool] | dict[str, bool | str] | dict[str, dict[str, bool | int | list[str]]]]` is not assignable to parameter `features` with type `dict[str, object]` in function `_create_workflow` [bad-argument-type]
   --> tests/unit_tests/services/workflow/test_workflow_restore.py:62:18
 ERROR Argument `list[FromClause]` is not assignable to parameter `tables` with type `Sequence[Table] | None` in function `sqlalchemy.sql.schema.MetaData.create_all` [bad-argument-type]

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.87%. Comparing base (792d154) to head (415288c).
⚠️ Report is 36 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #42799      +/-   ##
==========================================
+ Coverage   87.78%   87.87%   +0.09%     
==========================================
  Files        5092     5098       +6     
  Lines      319332   319829     +497     
  Branches    64543    64584      +41     
==========================================
+ Hits       280326   281055     +729     
+ Misses      33634    33387     -247     
- Partials     5372     5387      +15     
Flag Coverage Δ
api 87.62% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ghfind-review ghfind-review Bot added the review: top ghfind author score; see https://ghfind.com label Sep 23, 2026
@Stream29
Stream29 self-requested a review September 24, 2026 02:02
@Stream29

Copy link
Copy Markdown
Contributor

It feels so good to review a small PR that is easy to read.

@Stream29

Copy link
Copy Markdown
Contributor

Simple and clear logic with good tests. LGTM.

@Stream29
Stream29 added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit 4b89972 Oct 2, 2026
53 checks passed
@Stream29
Stream29 deleted the laipz8200/fix-redis-subscription-close branch October 2, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: top ghfind author score; see https://ghfind.com size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants